import * as types from './mutations-types'
import utils from '@/utils'
console.log('utils', utils);
const matutions = {
  [types.LOGIN] (state) {
    state.hasLogin = true
  },
  [types.LOGOUT] (state) {
    state.hasLogin = false
    state.hasUserInfoLogin = false

    state.userInfo = {}
    utils.setCache('userInfo', state.userInfo)
  },
  [types.SETUSERINFO] (state, userInfo) {
    state.userInfo = Object.assign({}, state.userInfo, userInfo)
    utils.setCache('userInfo', state.userInfo)
  },
  [types.SETDATAILUSERINFO] (state, userInfo) {
    state.userInfo = Object.assign({}, state.userInfo, userInfo)
    console.log('userInfo', userInfo);
    state.hasUserInfoLogin = true
    state.hasLogin = true
    utils.setCache('userInfo', state.userInfo)
  },
  [types.SETPHONE] (state, phone) {
    state.phone = phone
  },
}


export default matutions